#!/bin/sh

if [ -n "$1" ]; then
    data_date=$1
else
  data_date=$(date -d "-1 days" +%F)
fi


LOAD_DATA_PROVINCE="
load data inpath '/warehouse/app_basic/t_md_areas/${data_date}' overwrite into table xm1_ods.ods_province partition (dt='${data_date}');"

LOAD_DATA_LOG="
load data inpath '/warehouse/app_logs/${data_date}' overwrite into table xm1_ods.ods_log partition (dt='${data_date}');"

/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "${LOAD_DATA_PROVINCE}${LOAD_DATA_LOG}"